package graph.group.zhangtao.guider;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;

import graph.group.zhangtao.guider.adapter.MyAdapter;
import graph.group.zhangtao.guider.utils.GetLocalFiles;
import graph.group.zhangtao.guider.utils.MySettingsAndTools;

public class RecycleActivity extends AppCompatActivity {

    private RecyclerView mRecycleView;
    private MyAdapter myAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycle);
        mRecycleView = (RecyclerView) findViewById(R.id.recycleView);
        initview();
    }

    private void initview() {
        //初始化本地列表
        GetLocalFiles.setLocalPath(this.getFilesDir().getAbsolutePath());
        GetLocalFiles.initLocalViewKeys();
        Toast.makeText(this,GetLocalFiles.getFullDirPath(),Toast.LENGTH_LONG).show();
        mRecycleView = (RecyclerView) findViewById(R.id.recycleView);

        myAdapter = new MyAdapter(this,mRecycleView);
        mRecycleView.setAdapter(myAdapter);//设置适配器

        //设置布局管理器 , 将布局设置成纵向
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);
        mRecycleView.setLayoutManager(gridLayoutManager);


        //设置增加或删除条目动画
        mRecycleView.setItemAnimator(new DefaultItemAnimator());


    }
}
